﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet">
</head>
<body>
</body>
</html>

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Demo</title>
        <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
        <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet">
    </head>
    <body>

        <div class="layui-btn-container" style="margin-top: 20px;margin-bottom: 20px;">
            <h3>角色管理</h3>
            <ul class="layui-layout-right" style="margin-top: 20px;">
                <li>
                    <input type="text" placeholder="角色名称" id="roleName" style="line-height: 25px;"></input>
                    <button class="layui-btn layui-bg-blue" onclick="get()">查询</button>
                    <button class="layui-btn layui-btn-primary layui-border-blue" onclick="search()">高级查询</button>
                    <button class="layui-btn" lay-on="test-page-custom">新建</button>
                    <button class="layui-btn layui-bg-blue" onclick="edit()">编辑</button>
                    <button class="layui-btn layui-bg-red" onclick="delete()">删除</button>
                    <button class="layui-btn layui-btn-primary layui-border-green" onclick="enable()">导出</button>
                </li>
            </ul>
        </div>
        <table class="layui-hide" id="ID-treeTable-demo"></table>
        <script type="text/html" id="TPL-treeTable-demo">
            <div class="layui-btn-container">
              <button class="layui-btn layui-btn-sm" lay-event="getChecked">获取选中数据</button>
            </div>
        </script>
    <table class="layui-table" id="ID-table-demo-init">
       
        <thead>
            <tr>
                <th>序号</th>
                <th>角色</th>
                <th>权限</th>
                <th>状态</th>
                <th>操作 </th>
            </tr>
        </thead>
        <tbody id="ThisTb">
        </tbody>
    </table>

    <!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
    <script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>
    <script>
        $(function () {
            getList();
        })

        function getList() {
            $.ajax({
                url: '@ViewBag.Darius'+"/api/Users/PermissionRoleSearch",
                type: "get",
                dataType: "json",
                contentType: "application/json",
                success: function (res) {
                    $(res.data).each(function (i, item) {
                        $("#ThisTb").append(`<tr>
                                                        <td>${i + 1}</td>
                                                        <td>${item.roleName}</td>
                                                        <td>${item.permissionName}</td>
                                                        <td>启用</td>
                                                        <td>
                                                             <button type="button" class="layui-btn layui-bg-blue">编辑</button>
                                                             <button type="button" class="layui-btn layui-bg-orange">删除</button>
                                                        </td>
                                                    </tr>`)
                    })
                }
            })
        }
    </script>
    </body>
</html>
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
<script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>
<script>

    layui.use(function () {
        var $ = layui.$;
        var layer = layui.layer;
        var util = layui.util;
        var form = layui.form;
        // 事件
        util.on('lay-on', {
            'test-page-custom': function () {
                layer.open({
                    type: 2,
                    area: ['800px','800px'],
                    shadeClose: true,
                    title: '角色管理（新建）',
                    content: '/Users/RoleAlertView',

                });
            }
        });
    });

</script>
